package com.assignwork.modules.pc.service.pc.impl;
import com.assignwork.dto.pcplan.ShipStatSearchDto;
import com.assignwork.entity.pc.ShipStat;
import com.assignwork.mapper.ShipStatMapper;
import com.assignwork.modules.pc.service.pc.IShipStatService;
import com.assignwork.vo.pc.ShipStatVo;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.DictBizCache;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName IShipStatServiceImpl
 * @Description
 * @Author sl
 * @Date 2023/11/30 9:57
 */
@Service
@AllArgsConstructor
public class ShipStatServiceImpl extends BaseServiceImpl<ShipStatMapper, ShipStat> implements IShipStatService {
    @Override
    public List<ShipStatVo> selectShipStatList(ShipStatSearchDto dto) {
        List<ShipStatVo> ShipStatVos = baseMapper.selectShipStatList(dto);

        ShipStatVos.forEach(vo -> {
            if (!Func.isNull(vo.getBerthCode()) && !Func.isBlank(vo.getBerthCode())) {
                vo.setBerthName(DictBizCache.getValue("berth", vo.getBerthCode()));
            }
        });

        return ShipStatVos;
    }
}
